package dr.request.user.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import dr.controller.*;

public class RequestWriteFormAction extends ActionSupportLogin{
	
	public String execute(HttpServletRequest request,
			HttpServletResponse response) throws Throwable {

		String id=getUserLoginId(request);// session
		
		//login check
		if(id==null) return LOGINULL_PATH;
		//login check
		
		//제목글과 답변글의 구분
		int num = 0;
		int ref = 1;
		int re_step = 0;
		int re_level = 0;
		
		if(request.getParameter("num") != null){
			num = Integer.parseInt(request.getParameter("num"));
			ref = Integer.parseInt(request.getParameter("ref"));
			re_step = Integer.parseInt(request.getParameter("re_step"));
			re_level = Integer.parseInt(request.getParameter("re_level"));
		}
		
		//해당뷰에서 사용할 속성
		request.setAttribute("sessionId", id);
		request.setAttribute("num", new Integer(num));
		request.setAttribute("ref", new Integer(ref));
		request.setAttribute("re_step", new Integer(re_step));
		request.setAttribute("re_level", new Integer(re_level));
		
		return "/request/writeForm.jsp";
	}

}
